package com.efast.cafe.portal.entity.common.tree;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class CommonTree extends Tree{

    public CommonTree() {}
    
   

    public TreeNode transform(Object info) {
        Map<String ,Object> maps  = (Map<String ,Object>) info;
        TreeNode node = new TreeNode();
        node.setNodeId(maps.get("id")!=null?(Integer)maps.get("id"):null);
        node.setParentId(maps.get("parentId")!=null?(Integer)maps.get("parentId"):null);
        node.setTreeLevel((Integer)maps.get("treeLevel"));
        node.setBindData(maps);
        node.setChildren(new ArrayList<>());
        return node;
    }

    
    public Object getCatalogNode(String catalogId) {
        TreeNode node = super.getTreeNode(catalogId);
        return node == null ? null : node.getBindData();
    }

}
